package com.lrkj.back.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lrkj.back.Const;
import com.lrkj.back.entity.TbEmployee;
import com.lrkj.back.entity.TbPackageMuban;
import com.lrkj.back.entity.ZsWupinYcpFafang;
import com.lrkj.back.service.TbManufactorService;
import com.lrkj.back.service.TbPackageMubanService;
import com.lrkj.back.service.ZsWupinBaoFafangService;
import com.lrkj.back.service.ZsWupinFafangService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.lrkj.back.entity.TbDepartment;
import com.lrkj.back.entity.ZsKeshiKucun;
import com.lrkj.back.entity.ZsPackageImformation;
import com.lrkj.back.entity.ZsShenqing;
import com.lrkj.back.entity.ZsShenqingShoushubaoMingxi;
import com.lrkj.back.entity.ZsShenqingYicipinMingxi;
import com.lrkj.back.entity.ZsWupinBaoFafang;
import com.lrkj.back.entity.ZsWupinFafang;
import com.lrkj.back.entity.ZsYicipinKucun;
import com.lrkj.back.service.TbDepartmentService;
import com.lrkj.back.service.TbEmployeeService;
import com.lrkj.back.service.TbSeqService;
import com.lrkj.back.service.ZsKeshiKucunService;
import com.lrkj.back.service.ZsPackageImformationService;
import com.lrkj.back.service.ZsShenqingService;
import com.lrkj.back.service.ZsShenqingShoushubaoMingxiService;
import com.lrkj.back.service.ZsShenqingYicipinMingxiService;
import com.lrkj.back.service.ZsWupinYcpFafangService;
import com.lrkj.back.service.ZsYicipinKucunService;
import com.lrkj.back.service.ZsYicipinRukuService;
import cn.com.cbons.mamisay.parent.exception.BusinessException;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;

@Controller
@RequestMapping("/shenqing")
public class ZsShenqingController extends BaseController{

	@Autowired
	private ZsYicipinRukuService yicipinService;
	@Autowired
	private ZsShenqingService shenqingService;
	@Autowired
	private TbManufactorService manufactorService;
	@Autowired
	private ZsShenqingYicipinMingxiService sqmxService;
	@Autowired
	private TbSeqService seqService;
	@Autowired
	private ZsShenqingShoushubaoMingxiService ssbservice;
	@Autowired
	private ZsPackageImformationService packageInfomationservice;
	@Autowired
	private ZsYicipinKucunService kucunService;
	@Autowired
	private TbPackageMubanService mubanservice;
	@Autowired
	private TbSeqService  sepservice;
	@Autowired
	private ZsWupinBaoFafangService baofafangservice;
	@Autowired
	private ZsWupinYcpFafangService  yicipinfafangservice;
	@Autowired
	private ZsWupinFafangService wupingfafangservice;
	@Autowired
	private TbDepartmentService   departmentservice;
	@Autowired
	private TbEmployeeService tbEmployeeService;
	@Autowired
	private ZsWupinBaoFafangService wupinBaoFafangService;
	@Autowired
	private ZsShenqingShoushubaoMingxiService shenqingshoushubaomingxiService;
	@Autowired
	private  ZsWupinFafangService wupinFafangService;
	@Autowired
	private  ZsKeshiKucunService keshiKucunService;
	
	//物品发放--物品申请信息：用到的方法，此处查的是申请表
	@RequestMapping("/shenqingList.do")
	public ModelAndView yicipinApplyList(String searchTxt,HttpServletRequest request,
			HttpServletResponse response)throws BusinessException{
		Integer pageNo = request.getParameter("pageIndex")==null? 1 :Integer.valueOf(request.getParameter("pageIndex"));
		Map<String,Object> map =new HashMap<>();
		if(StringUtils.isNotBlank(searchTxt)){
			searchTxt=searchTxt.trim();
			map.put("shenqingKeshi", searchTxt);
		}
		//查所有信息
		List<TbDepartment> alldeparts=departmentservice.findAllDepartment();
		map.put("pageNo", pageNo);
		map.put("pageSize", Const.PAGE_SIZE);
		//把分页信息传过去
		PageInfo<ZsShenqing> page = shenqingService.findAllShenqing(map);
		request.setAttribute("shenqingList", page.getList());
		request.setAttribute("searchTxt", searchTxt==null?"":searchTxt);
		request.setAttribute("total", page.getPages());
		request.setAttribute("alldeparts",alldeparts );
		//返回到页面
		return new ModelAndView("/wupinfafang/wupinshenqing/shenqing_list");
	}
	//点添加时用到的方法，把库存信息传到下拉框
	@RequestMapping("/shoushubaoApplyEdit.do")
	public ModelAndView yicipinApplyEdit(String id, HttpServletRequest request,
			HttpServletResponse response)throws BusinessException{
		Map<String, Object> map = new HashMap<String,Object>();
		ZsShenqing shenqing = (id == null) ? new ZsShenqing() : shenqingService.selectByPrimaryKey(id);
//		Map<String,Object> map =new HashMap<String,Object>();
//		if(StringUtils.isNotBlank(id)){
//			map.put("shenqingKeshi", id);
//		}
//		List<ZsShenqingYicipinMingxi> mingxiList = shenqingservice.findAllShenqingMingxi(map);
//		if(mingxiList == null)
//			mingxiList = new ArrayList<ZsShenqingYicipinMingxi>();
//		shenqing.setMingxiList(mingxiList);
		List<TbPackageMuban> proList = mubanservice.findAllPackageNoPageList(map);
		request.setAttribute("proList", proList);
		request.setAttribute("proJson", JSON.toJSON(proList));
		request.setAttribute("shenqing", shenqing);
		return new ModelAndView("/shoushubao/shoushubao_edit");
	}
	//点保存按纽时用到的方法
	@RequestMapping("/shoushubaoApplySave.do")
	@ResponseBody
	public Map<Object, Object> yicipinApplySave(HttpServletRequest request,
			HttpServletResponse response)throws BusinessException{
		Map<Object, Object> rtnMap = new HashMap<Object,Object>();
		//保存时先保存主表，再保存手术包那个表
		try {
			String[] proId = request.getParameterValues("productId");
			String[] proName = request.getParameterValues("productName");
			String[] proNum = request.getParameterValues("productNum");
			SimpleDateFormat sdf= new SimpleDateFormat("yyyyMMdd");
			String shenqingliushui = sdf.format(new Date())+seqService.seqVal("shenqingno");
			ZsShenqing sq = new ZsShenqing();
			sq.setShenqingLiushui(shenqingliushui);
			sq.setRecordTime(new Date());
			sq.setShenqingFenlei(0);
			sq.setShenqingShenqingrenTiaoma("");
			sq.setShenqingTime(new Date());
			shenqingService.insert(sq);
			ZsShenqingShoushubaoMingxi mingxi = null;
			//同时加入多 个对象
			for(int i = 0 ;i<proId.length;i++){
				mingxi = new ZsShenqingShoushubaoMingxi();
				mingxi.setShenqingLiushui((shenqingliushui));
				mingxi.setShenqingMingxiLiushui(sdf.format(new Date())+seqService.seqVal("shoushubaono"));
				mingxi.setShenqingWupinbaoMuban(proId[i]);
				mingxi.setShenqingWupinbaoMingcheng(proName[i]);
				mingxi.setShenqingWupinbaoShuliang(Integer.valueOf(proNum[i]));
				mingxi.setFafangZhuangtai(0);
				mingxi.setRecordTime(new Date());
				ssbservice.insert(mingxi); 
			}
			rtnMap.put("status", "true");
			rtnMap.put("msg", "编辑成功");
		} catch (Exception e) {
			rtnMap.put("status", "false");
			rtnMap.put("msg", "编辑失败");
			e.printStackTrace();
		}
		return rtnMap;
	}
	
	//物品发放--物品申请信息   点击发放时用到的方法（发放的是一次品）
	@RequestMapping("/wupingfafang.do")
	@ResponseBody
	@Transactional
	public Map<Object, Object> yicipinApplyDel(HttpServletRequest request,String fafangren, HttpServletResponse response)throws BusinessException{
		Map<Object, Object> rtnMap = new HashMap<Object,Object>();
		try {
			//包的模板ID集合(用于判断)
			List<Integer> list = new ArrayList<Integer>();
			//申请流水
			String shenqingls=request.getParameter("shenqingliushui");
			Date date = new Date();
//			String leixins=request.getParameter("mingxi");
//			String[]  leixin=leixins.split(",");
			//修改申请表数据---------------------
			SimpleDateFormat sdf= new SimpleDateFormat("yyyyMMdd");
			String proId = sdf.format(date)+seqService.seqVal("wupinfafangno");
			ZsShenqing sq = shenqingService.selectByPrimaryKey(shenqingls);
			sq.setFafangZhuangtai(1);
			//物品发放表-----------------
			ZsWupinFafang wupingfafang=new ZsWupinFafang();
			wupingfafang.setFafangLiushui(proId);
			int fafangleixin=sq.getShenqingFenlei();
			wupingfafang.setFangfangLeixing(fafangleixin);
			wupingfafang.setFafangRiqi(date);
			wupingfafang.setShenqingLiushui(shenqingls);
			wupingfafang.setRecordTime(date);
			wupingfafang.setFafangrenTiaoma(fafangren);
			Integer fafangkeshi = null;
			ZsKeshiKucun keshiKucun = null;
			ZsKeshiKucun keshiKucun1 = null;
			int shuliang = 0;
			List<ZsKeshiKucun> keshiKucuns = new ArrayList<ZsKeshiKucun>();
			Map<String,Object> map =new HashMap<String,Object>();
			if(StringUtils.isNotBlank(shenqingls)){
				map.put("shenqingLiushui", shenqingls);
			}
			if(fafangleixin==0){
				String tiaomasString=request.getParameter("tiaoma");
				String[] tiaomas = tiaomasString.split(",");
				//根据申请流水查到所有的申请明细，修改手术包申请明细表的状态--------------
				List<ZsShenqingShoushubaoMingxi> mingxiList = ssbservice.findAllShoushubaoApplyDetail(map);
				int  baoshuliang=0;
				//根据申请流水到申请手术包明细表中查找申请的手术包的条码
				List<ZsShenqingShoushubaoMingxi> shenqingShoushubaoMingxis =shenqingshoushubaomingxiService.findAllShoushubaoApplyDetail(map);
				//shenqingShoushubaoMingxis.size()==1   申请的包为一种
				//shenqingShoushubaoMingxis.size()!=1   申请的包为多种
				//-----------------------------------------------------------------------------------------------
				Integer shenqingbaoMuban=null;
				Integer shenqingbaoNum = null;
				ZsPackageImformation packageImformation = null;
				Integer fafangbaomuban = null;
				Map<Integer, Integer> fafangbaoMap = new HashMap<Integer,Integer>();
					//每次循环的都是一个包模板
				for (int i = 0; i < tiaomas.length; i++) {
					packageImformation = packageInfomationservice.selectByPrimaryKey(tiaomas[i]);
					fafangbaomuban = packageImformation.getPackageId();
					if (!fafangbaoMap.containsKey(fafangbaomuban)) {
						fafangbaoMap.put(fafangbaomuban,1);
					}else {
						fafangbaoMap.put(fafangbaomuban,fafangbaoMap.get(fafangbaomuban)+1);
					}
				}
				if (!fafangbaoMap.isEmpty()) {
					for (ZsShenqingShoushubaoMingxi zsShenqingShoushubaoMingxi : shenqingShoushubaoMingxis) {
						shenqingbaoMuban = Integer.valueOf(zsShenqingShoushubaoMingxi.getShenqingWupinbaoMuban());
						shenqingbaoNum = zsShenqingShoushubaoMingxi.getShenqingWupinbaoShuliang();
						if (fafangbaoMap.get(shenqingbaoMuban)!=shenqingbaoNum) {
							list.add(fafangbaoMap.get(shenqingbaoMuban));
						}
					}
				}
				//-----------------------------------------------------------------------------------------------
				if (list.isEmpty()) {
					Long[] seqArr = seqService.seqValBatch("baofafangliushui",tiaomas.length);
					List<ZsPackageImformation> packgaesListOne = new ArrayList<ZsPackageImformation>();
					List<ZsWupinBaoFafang> wupingbaos = new ArrayList<ZsWupinBaoFafang>();
					ZsShenqingShoushubaoMingxi shenqingmingxi = null;
					for(int i=0;i<mingxiList.size();i++){
						keshiKucun1 = new ZsKeshiKucun();
						shenqingmingxi =ssbservice.selectByPrimaryKey(mingxiList.get(i).getShenqingMingxiLiushui());
						shuliang = shenqingmingxi.getShenqingWupinbaoShuliang();
						baoshuliang=baoshuliang+shuliang;
						shenqingmingxi.setFafangZhuangtai(1);
						//------------科室财产管理
						map.put("keshiId", sq.getShenqingKeshi());
						map.put("mubanId", shenqingmingxi.getShenqingWupinbaoMuban());
						keshiKucun = keshiKucunService.findOne(map);
						keshiKucun1.setKeshiId(sq.getShenqingKeshi());
						keshiKucun1.setMubanId(shenqingmingxi.getShenqingWupinbaoMuban());
						if (keshiKucun != null) {
							keshiKucun1.setYiyouKucun(keshiKucun.getYiyouKucun() + shuliang);
						}else {
							keshiKucun1.setYiyouKucun(shuliang);
						}
						keshiKucun1.setXinzengKucun(shuliang);
						keshiKucun1.setDiushiKucun(0);
						keshiKucun1.setRecordTime(date);
						keshiKucuns.add(keshiKucun1);
						keshiKucun1.setKucunSort(1);
						//依次修改申请的明细-----------------------------------------
						ssbservice.updateByPrimaryKey(shenqingmingxi);
					}
					ZsPackageImformation onePackageImformation = null;
					ZsWupinBaoFafang baofafang = null;
					TbEmployee tbEmployee = null;
					for(int i=0;i<baoshuliang;i++){
						baofafang = new ZsWupinBaoFafang();
						baofafang.setRecordTime(date);
						// 主键
						baofafang.setBaoFafangLiushui(sdf.format(date)+ seqArr[i]);
						baofafang.setFafangLiushui(wupingfafang.getFafangLiushui());
						baofafang.setWupinbaoTiaoma(tiaomas[i]);
						packageImformation=packageInfomationservice.selectByPrimaryKey(tiaomas[i]);
//						fafangkeshi = packageImformation.getTbPackageMuban().getPackageDepartid();
						fafangkeshi = Integer.valueOf(sq.getShenqingKeshi());
						baofafang.setWupinbaoShuliang(1);
						baofafang.setFafangrenTiaoma(fafangren);
						baofafang.setShenqingLiushui(shenqingls);
						wupingbaos.add(baofafang);
						onePackageImformation = packageInfomationservice.selectByPrimaryKey(tiaomas[i]);
						onePackageImformation.setFafangLiushui(proId);
						onePackageImformation.setFafangMingxiliushui(sdf.format(date)+ seqArr[i]);
						onePackageImformation.setBaoRuku(0);
						onePackageImformation.setPackageLiuchengZhuangtai(6);
						onePackageImformation.setFafangTime(date);
						onePackageImformation.setFafangrenTiaoma(fafangren);
						if (sq.getShifouXuyao() == 1) {
							onePackageImformation.setKeshiId(Integer.valueOf(sq.getShenqingKeshi()));
						}
						tbEmployee = tbEmployeeService.selectByEmployeeNo(fafangren);
						if (tbEmployee!=null&&tbEmployee.getEmployeeNo().equals(fafangren)) {
							onePackageImformation.setFafangrenTiaoma(fafangren);
							onePackageImformation.setFafangrenName(tbEmployee.getEmployeeName());
						}
						packgaesListOne.add(onePackageImformation);
						
					}
					shenqingService.updateByPrimaryKey(sq);
					// 批量插入物品包的信息
					keshiKucunService.insertBatch(keshiKucuns);
					wupingfafang.setFangfaKeshi(fafangkeshi);
					wupingfafangservice.insert(wupingfafang);
					baofafangservice.insertPiliang(wupingbaos);
					packageInfomationservice.updateByBatch(packgaesListOne);
					rtnMap.put("status", "true");
					rtnMap.put("msg", "发放成功");
				}else {
					rtnMap.put("status","false");
					rtnMap.put("msg", "发放的包与申请的包不匹配");
				}
			}else{
				//修改一次品明细表
				List<ZsShenqingYicipinMingxi> mingxiList = sqmxService.findAllYicipinApplyDetail(map);
				sq.setFafangZhuangtai(1);
				sq.setShenqingLiushui(shenqingls);
				sq.setRecordTime(date);
				ZsWupinFafang wupinFafang = new ZsWupinFafang();
				wupinFafang.setFangfaKeshi(Integer.valueOf(sq.getShenqingKeshi()));
				wupinFafang.setFafangrenTiaoma(fafangren);
				wupinFafang.setFafangLiushui(sdf.format(date)+seqService.seqVal("ycpfafangliushui"));
				wupinFafang.setFafangRiqi(date);
				wupinFafang.setFangfangLeixing(1);
				wupinFafang.setRecordTime(date);
				wupinFafang.setShenqingLiushui(shenqingls);
				ZsWupinYcpFafang ycpfafang = null;
				ZsYicipinKucun yicipinKucun = null;
				ZsShenqingYicipinMingxi shenqingmingxi=null;
				List<ZsShenqingYicipinMingxi> shenqingYicipinMingxis = new ArrayList<ZsShenqingYicipinMingxi>();
				List<ZsYicipinKucun> yicipinKucuns = new ArrayList<ZsYicipinKucun>();
				List<ZsWupinYcpFafang> ycpFafangs = new ArrayList<ZsWupinYcpFafang>();
				List<Integer> panduan = new ArrayList<Integer>();
				for(ZsShenqingYicipinMingxi mx:mingxiList) {
					shenqingmingxi=sqmxService.selectByPrimaryKey(mx.getShenqingMingxiLiushui());
					shenqingmingxi.setFafangZhuangtai(1); 
					shenqingmingxi.setRecordTime(date);
					//依次修改所有的明细(用批量修改)
					shenqingYicipinMingxis.add(shenqingmingxi);
//					sqmxService.updateByPrimaryKey(shenqingmingxi);
 					yicipinKucun = kucunService.selectByPrimaryKey(shenqingmingxi.getShenqingYicipinBianhao());
					if (yicipinKucun.getProductNum() < shenqingmingxi.getShenqingYicipinShuliang()) {
						panduan.add(shenqingmingxi.getShenqingYicipinShuliang());
					}else {
						yicipinKucun.setProductNum(yicipinKucun.getProductNum()-shenqingmingxi.getShenqingYicipinShuliang());
					}
					//在一次性 物品发放表中加上相关数据 据
					ycpfafang=new ZsWupinYcpFafang();
					ycpfafang.setYicipinShuliang(shenqingmingxi.getShenqingYicipinShuliang());
					//主键
					ycpfafang.setYcpFafangLiushui(sdf.format(date)+seqService.seqVal("ycpfafangliushui"));
					ycpfafang.setFafangLiushui(wupinFafang.getFafangLiushui());
//					ycpfafang.setYicipinTiaoma(shenqingmingxi.getShenqingYicipinMingcheng());
					ycpfafang.setYicipinTiaoma(shenqingmingxi.getShenqingYicipinBianhao());
					ycpfafang.setShenqingLiushui(shenqingmingxi.getShenqingLiushui());
					TbEmployee tbEmployee = tbEmployeeService.selectByEmployeeNo(fafangren);
					if (tbEmployee!=null&&tbEmployee.getEmployeeNo().equals(fafangren)) {
						ycpfafang.setFafangrenTiaoma(fafangren);
					}
//					kucunService.updateKucun(shenqingmingxi.getShenqingYicipinBianhao(),-shenqingmingxi.getShenqingYicipinShuliang());
					ycpfafang.setRecordTime(date);
					ycpFafangs.add(ycpfafang);
					yicipinKucuns.add(yicipinKucun);
					
					map.put("keshiId", sq.getShenqingKeshi());
					map.put("mubanId", shenqingmingxi.getShenqingYicipinBianhao());
					keshiKucun = keshiKucunService.findOne(map);
					keshiKucun1 = new ZsKeshiKucun();
					keshiKucun1.setKeshiId(sq.getShenqingKeshi());
					keshiKucun1.setMubanId(shenqingmingxi.getShenqingYicipinBianhao());
					shuliang = shenqingmingxi.getShenqingYicipinShuliang();
					if (keshiKucun != null) {
						keshiKucun1.setYiyouKucun(keshiKucun.getYiyouKucun() + shuliang);
					}else {
						keshiKucun1.setYiyouKucun(shuliang);
					}
					keshiKucun1.setKucunSort(2);
					keshiKucun1.setXinzengKucun(shuliang);
					keshiKucun1.setDiushiKucun(0);
					keshiKucun1.setRecordTime(date);
					keshiKucuns.add(keshiKucun1);
				}
				if (panduan.isEmpty()) {
					shenqingService.updateByPrimaryKeySelective(sq);
					yicipinfafangservice.insertBatch(ycpFafangs);
					keshiKucunService.insertBatch(keshiKucuns);
					sqmxService.updateByBatch(shenqingYicipinMingxis);
					wupinFafangService.insert(wupinFafang);
					kucunService.updateByBatch(yicipinKucuns);
					rtnMap.put("status", "true");
					rtnMap.put("msg", "发放成功");
				}else {
					rtnMap.put("status", "false");
					rtnMap.put("msg", "库存不足");
				}
			}
		} catch (Exception e) {
			rtnMap.put("status", "false");
			rtnMap.put("msg", "发放失败");
			e.printStackTrace();
		}
		return rtnMap;
	}

	//右边显示详细信息的方法,这个是手术包用的
	@RequestMapping("/shoushubaoApplyDetailList.do")
	@ResponseBody
	public Map<Object, Object> shoushubaoApplyDetailList(String id,HttpServletRequest request,
			HttpServletResponse response)throws BusinessException{
		Map<Object, Object> rtnMap = new HashMap<Object,Object>();
		int shoushubaonums=0;
		try {
			Map<String,Object> map =new HashMap<String,Object>();
			if(StringUtils.isNotBlank(id)){
				map.put("shenqingLiushui", id);
			}
			List<ZsShenqingShoushubaoMingxi> mingxiList = ssbservice.findAllShoushubaoApplyDetail(map);
			for(int i=0;i<mingxiList.size();i++){
				shoushubaonums=shoushubaonums+mingxiList.get(i).getShenqingWupinbaoShuliang();
			}
			rtnMap.put("mxList", mingxiList);
			rtnMap.put("shoushubaoshuliang", shoushubaonums);
			rtnMap.put("status", "true");
			rtnMap.put("msg", "编辑成功");
		} catch (Exception e) {
			rtnMap.put("status", "false");
			rtnMap.put("msg", "编辑失败");
			e.printStackTrace();
		}
		return rtnMap;
	}

	//右边显示详细信息的方法,这个是一次品用的
	@RequestMapping("/yicipinApplyDetailList.do")
	@ResponseBody
	public Map<Object, Object> yicipinApplyDetailList(String id,HttpServletRequest request, HttpServletResponse response) throws BusinessException{
		Map<Object, Object> rtnMap = new HashMap<Object,Object>();
		try {
			Map<String,Object> map =new HashMap<String,Object>();
			if(StringUtils.isNotBlank(id)){
				map.put("shenqingLiushui", id);
			}
			List<ZsShenqingYicipinMingxi> mingxiList = sqmxService.findAllYicipinApplyDetail(map);
			rtnMap.put("mxList", mingxiList);
			rtnMap.put("status", "true");
			rtnMap.put("msg", "编辑成功");
		} catch (Exception e) {
			rtnMap.put("status", "false");
			rtnMap.put("msg", "编辑失败");
			e.printStackTrace();
		}
		return rtnMap;
	}
	
    @RequestMapping("/judgefafangren.do")
	@ResponseBody
    public Map<Object, Object> judgefafangren(String fafangren,HttpServletRequest request,
			HttpServletResponse response) throws BusinessException{
    	Map<Object, Object> rtnMap = new HashMap<Object,Object>();
    	TbEmployee tbEmployee = tbEmployeeService.selectByEmployeeNo(fafangren);
    	if (tbEmployee!=null&&tbEmployee.getEmployeeNo().equals(fafangren)) {
			rtnMap.put("status", "");
			rtnMap.put("msg", "保存成功");
		}else {
			rtnMap.put("status", "false");
			rtnMap.put("msg", "无效发放人条码");
		}
		return rtnMap;
    }
}

